package com.yang.controller;

import com.yang.entity.Deposit;
import com.yang.service.DepositService;
import com.yang.utils.UtilsFactory;
import com.yang.utils.info.NoteResponseInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 充值表(Deposit)表控制层
 *
 * @author yangdacheng
 * @since 2022-03-02 19:11:02
 */
@RestController
@RequestMapping("deposit")
public class DepositController {
    /**
     * 服务对象
     */
    @Resource
    private DepositService depositService;

    /**
     * 查询所有的充值对象  展示的
     * @return
     */
    @GetMapping("queryAllDep")
    public NoteResponseInfo queryAllDep(){
        NoteResponseInfo noteResponseInfo = new NoteResponseInfo();
        List<Deposit> deposits = depositService.queryAllDeposit(1); //查询首页展示的充值对象
        deposits.sort((dep1,dep2) -> Float.compare(dep1.getDepositMoney(),dep2.getDepositMoney())); //进行排序
        noteResponseInfo.setNoteCode(200).setNoteMessage("查询成功").setNoteClass(deposits);
        return noteResponseInfo;
    }
}